<template>
    <div v-loading="isLoading" class="iframe">
        <!-- 积分兑换明细中转页面 -->
        <iframe v-if="isShowIframe" :src="pointIframe" frameborder="0" width="100%" height="700px"></iframe>
    </div>
</template>

<script>
import { mapState } from 'vuex'
import { getDictSelectList } from '@/utils/Common'
import { getToken, getTokenHsbankNo } from '@/utils/auth';

export default {
    name: 'pointsExchangeEnquiry',
    data() {
        return {
            bankCode: '',
            identityCard: '',
            sysAdmin: '',
            creditsCard: '',
            pointIframe: '',
            isShowIframe: false, //iframe是否正常显示
            isLoading: true//页面loading
        }
    },
    created() {
        this.bankCode = getTokenHsbankNo('HsbankNo')
        this.identityCard = this.cardInfo_3004.CUSTID
        this.sysAdmin = this.defaultParams.body.appHead.opeNo
        this.creditsCard = this.cardInfo_3004.CARDNO
    },
    computed: {
        ...mapState({
            cardInfo_3004: state => state.common.cardInfo_3004,
            defaultParams: state => state.common.defaultParams,
        })
    },
    mounted() {
        this.getPointFrame()
    },
    methods: {
        //通过数据字典获取iframe路径
        async getPointFrame() {
            const frameURL = await getDictSelectList("URLSJF", this);
            frameURL.forEach(item => {
                if (item.code === '8') {
                    this.pointIframe = item.label
                    return
                }
            });
            if (this.bankCode != '' && this.identityCard != '' && this.sysAdmin != '' && this.creditsCard != '' && this.pointIframe != '') {
                this.isShowIframe = true
                this.isLoading = false
            } else {
                this.$alert(
                    "加载失败，请重新进入",
                    '提示',
                    {
                        customClass: 'error'

                    }
                )
            }
            this.pointIframe = this.pointIframe + 'bankCode=' + this.bankCode + '&identityCard=' + this.identityCard + '&sysAdmin=' + this.sysAdmin + '&creditsCard=' + this.creditsCard
            console.log(this.pointIframe)
        }
    }

}
</script>

<style lang='scss'>
</style>
